home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / bfd / elf64-target.h < prev    next >
C/C++ Source or Header  |  1994-07-26  |  12KB  |  366 lines

  1. /* Target definitions for 64-bit ELF
  2.    Copyright 1993, 1994 Free Software Foundation, Inc.
  3.  
  4. This file is part of BFD, the Binary File Descriptor library.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20. /* This structure contains everything that BFD knows about a target.
  21.    It includes things like its byte order, name, what routines to call
  22.    to do various operations, etc.  Every BFD points to a target structure
  23.    with its "xvec" member.
  24.  
  25.    There are two such structures here:  one for big-endian machines and
  26.    one for little-endian machines.   */
  27.  
  28. #define    bfd_elf64_close_and_cleanup _bfd_generic_close_and_cleanup
  29. #define bfd_elf64_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
  30. #ifndef bfd_elf64_get_section_contents
  31. #define bfd_elf64_get_section_contents _bfd_generic_get_section_contents
  32. #endif
  33.  
  34. #define bfd_elf64_bfd_debug_info_start    bfd_void
  35. #define bfd_elf64_bfd_debug_info_end    bfd_void
  36. #define bfd_elf64_bfd_debug_info_accumulate    (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
  37. #define bfd_elf64_bfd_get_relocated_section_contents \
  38.  bfd_generic_get_relocated_section_contents
  39. #define bfd_elf64_bfd_relax_section bfd_generic_relax_section
  40. #define bfd_elf64_bfd_make_debug_symbol \
  41.   ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
  42.  
  43. #ifndef bfd_elf64_bfd_copy_private_section_data
  44. #define bfd_elf64_bfd_copy_private_section_data \
  45.   ((boolean (*) PARAMS ((bfd *, asection *, bfd *, asection *))) bfd_true)
  46. #endif
  47. #ifndef bfd_elf64_bfd_copy_private_bfd_data
  48. #define bfd_elf64_bfd_copy_private_bfd_data \
  49.   ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
  50. #endif
  51. #ifndef bfd_elf64_bfd_is_local_label
  52. #define bfd_elf64_bfd_is_local_label bfd_generic_is_local_label
  53. #endif
  54.  
  55. #ifndef bfd_elf64_get_dynamic_reloc_upper_bound
  56. #define bfd_elf64_get_dynamic_reloc_upper_bound \
  57.   _bfd_nodynamic_get_dynamic_reloc_upper_bound
  58. #endif
  59. #ifndef bfd_elf64_canonicalize_dynamic_reloc
  60. #define bfd_elf64_canonicalize_dynamic_reloc \
  61.   _bfd_nodynamic_canonicalize_dynamic_reloc
  62. #endif
  63.  
  64. #ifdef elf_backend_relocate_section
  65. #ifndef bfd_elf64_bfd_link_hash_table_create
  66. #define bfd_elf64_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
  67. #endif
  68. #else /* ! defined (elf_backend_relocate_section) */
  69. /* If no backend relocate_section routine, use the generic linker.  */
  70. #ifndef bfd_elf64_bfd_link_hash_table_create
  71. #define bfd_elf64_bfd_link_hash_table_create \
  72.   _bfd_generic_link_hash_table_create
  73. #endif
  74. #ifndef bfd_elf64_bfd_link_add_symbols
  75. #define bfd_elf64_bfd_link_add_symbols    _bfd_generic_link_add_symbols
  76. #endif
  77. #ifndef bfd_elf64_bfd_final_link
  78. #define bfd_elf64_bfd_final_link    _bfd_generic_final_link
  79. #endif
  80. #endif /* ! defined (elf_backend_relocate_section) */
  81.  
  82. #ifndef elf_info_to_howto_rel
  83. #define elf_info_to_howto_rel 0
  84. #endif
  85.  
  86. #ifndef ELF_MAXPAGESIZE
  87. #define ELF_MAXPAGESIZE 1
  88. #endif
  89.  
  90. #ifndef elf_backend_collect
  91. #define elf_backend_collect false
  92. #endif
  93.  
  94. #ifndef elf_backend_sym_is_global
  95. #define elf_backend_sym_is_global    0
  96. #endif
  97. #ifndef elf_backend_object_p
  98. #define elf_backend_object_p        0
  99. #endif
  100. #ifndef elf_backend_symbol_processing
  101. #define elf_backend_symbol_processing    0
  102. #endif
  103. #ifndef elf_backend_symbol_table_processing
  104. #define elf_backend_symbol_table_processing    0
  105. #endif
  106. #ifndef elf_backend_section_processing
  107. #define elf_backend_section_processing    0
  108. #endif
  109. #ifndef elf_backend_section_from_shdr
  110. #define elf_backend_section_from_shdr    0
  111. #endif
  112. #ifndef elf_backend_fake_sections
  113. #define elf_backend_fake_sections    0
  114. #endif
  115. #ifndef elf_backend_section_from_bfd_section
  116. #define elf_backend_section_from_bfd_section    0
  117. #endif
  118. #ifndef elf_backend_add_symbol_hook
  119. #define elf_backend_add_symbol_hook    0
  120. #endif
  121. #ifndef elf_backend_link_output_symbol_hook
  122. #define elf_backend_link_output_symbol_hook 0
  123. #endif
  124. #ifndef elf_backend_create_dynamic_sections
  125. #define elf_backend_create_dynamic_sections 0
  126. #endif
  127. #ifndef elf_backend_check_relocs
  128. #define elf_backend_check_relocs    0
  129. #endif
  130. #ifndef elf_backend_adjust_dynamic_symbol
  131. #define elf_backend_adjust_dynamic_symbol 0
  132. #endif
  133. #ifndef elf_backend_size_dynamic_sections
  134. #define elf_backend_size_dynamic_sections 0
  135. #endif
  136. #ifndef elf_backend_relocate_section
  137. #define elf_backend_relocate_section    0
  138. #endif
  139. #ifndef elf_backend_finish_dynamic_symbol
  140. #define elf_backend_finish_dynamic_symbol    0
  141. #endif
  142. #ifndef elf_backend_finish_dynamic_sections
  143. #define elf_backend_finish_dynamic_sections    0
  144. #endif
  145. #ifndef elf_backend_begin_write_processing
  146. #define elf_backend_begin_write_processing    0
  147. #endif
  148. #ifndef elf_backend_final_write_processing
  149. #define elf_backend_final_write_processing    0
  150. #endif
  151. #ifndef elf_backend_ecoff_debug_swap
  152. #define elf_backend_ecoff_debug_swap    0
  153. #endif
  154.  
  155. static CONST struct elf_backend_data elf64_bed =
  156. {
  157. #ifdef USE_REL
  158.   0,                /* use_rela_p */
  159. #else
  160.   1,                /* use_rela_p */
  161. #endif
  162.   1,                /* elf_64_p */
  163.   ELF_ARCH,            /* arch */
  164.   ELF_MACHINE_CODE,        /* elf_machine_code */
  165.   ELF_MAXPAGESIZE,        /* maxpagesize */
  166.   elf_backend_collect,
  167.   elf_info_to_howto,
  168.   elf_info_to_howto_rel,
  169.   elf_backend_sym_is_global,
  170.   elf_backend_object_p,
  171.   elf_backend_symbol_processing,
  172.   elf_backend_symbol_table_processing,
  173.   elf_backend_section_processing,
  174.   elf_backend_section_from_shdr,
  175.   elf_backend_fake_sections,
  176.   elf_backend_section_from_bfd_section,
  177.   elf_backend_add_symbol_hook,
  178.   elf_backend_link_output_symbol_hook,
  179.   elf_backend_create_dynamic_sections,
  180.   elf_backend_check_relocs,
  181.   elf_backend_adjust_dynamic_symbol,
  182.   elf_backend_size_dynamic_sections,
  183.   elf_backend_relocate_section,
  184.   elf_backend_finish_dynamic_symbol,
  185.   elf_backend_finish_dynamic_sections,
  186.   elf_backend_begin_write_processing,
  187.   elf_backend_final_write_processing,
  188.   elf_backend_ecoff_debug_swap
  189. };
  190.  
  191. #ifdef TARGET_BIG_SYM
  192. const bfd_target TARGET_BIG_SYM =
  193. {
  194.   /* name: identify kind of target */
  195.   TARGET_BIG_NAME,
  196.  
  197.   /* flavour: general indication about file */
  198.   bfd_target_elf_flavour,
  199.  
  200.   /* byteorder_big_p: data is big endian */
  201.   true,
  202.  
  203.   /* header_byteorder_big_p: header is also big endian */
  204.   true,
  205.  
  206.   /* object_flags: mask of all file flags */
  207.   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
  208.    DYNAMIC | WP_TEXT | D_PAGED),
  209.   
  210.   /* section_flags: mask of all section flags */
  211.   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
  212.    SEC_CODE | SEC_DATA | SEC_DEBUGGING),
  213.  
  214.    /* leading_symbol_char: is the first char of a user symbol
  215.       predictable, and if so what is it */
  216.    0,
  217.  
  218.   /* ar_pad_char: pad character for filenames within an archive header
  219.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  220.      of the archiver and/or os and should be independently tunable */
  221.   '/',
  222.  
  223.   /* ar_max_namelen: maximum number of characters in an archive header
  224.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  225.      of the archiver and should be independently tunable.  This value is
  226.      a WAG (wild a** guess) */
  227.   14,
  228.  
  229.   /* align_power_min: minimum alignment restriction for any section
  230.      FIXME:  this value may be target machine dependent */
  231.   3,
  232.  
  233.   /* Routines to byte-swap various sized integers from the data sections */
  234.   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  235.     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  236.     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
  237.  
  238.   /* Routines to byte-swap various sized integers from the file headers */
  239.   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  240.     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  241.     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
  242.  
  243.   /* bfd_check_format: check the format of a file being read */
  244.   { _bfd_dummy_target,        /* unknown format */
  245.     bfd_elf64_object_p,        /* assembler/linker output (object file) */
  246.     bfd_generic_archive_p,    /* an archive */
  247.     bfd_elf64_core_file_p    /* a core file */
  248.   },
  249.  
  250.   /* bfd_set_format: set the format of a file being written */
  251.   { bfd_false,
  252.     bfd_elf_mkobject,
  253.     _bfd_generic_mkarchive,
  254.     bfd_false
  255.   },
  256.  
  257.   /* bfd_write_contents: write cached information into a file being written */
  258.   { bfd_false,
  259.     bfd_elf64_write_object_contents,
  260.     _bfd_write_archive_contents,
  261.     bfd_false
  262.   },
  263.  
  264.       BFD_JUMP_TABLE_GENERIC (bfd_elf64),
  265.       BFD_JUMP_TABLE_COPY (bfd_elf64),
  266.       BFD_JUMP_TABLE_CORE (bfd_elf64),
  267.       BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  268.       BFD_JUMP_TABLE_SYMBOLS (bfd_elf64),
  269.       BFD_JUMP_TABLE_RELOCS (bfd_elf64),
  270.       BFD_JUMP_TABLE_WRITE (bfd_elf64),
  271.       BFD_JUMP_TABLE_LINK (bfd_elf64),
  272.       BFD_JUMP_TABLE_DYNAMIC (bfd_elf64),
  273.  
  274.   /* backend_data: */
  275.   (PTR) &elf64_bed,
  276. };
  277. #endif
  278.  
  279. #ifdef TARGET_LITTLE_SYM
  280. const bfd_target TARGET_LITTLE_SYM =
  281. {
  282.   /* name: identify kind of target */
  283.   TARGET_LITTLE_NAME,
  284.  
  285.   /* flavour: general indication about file */
  286.   bfd_target_elf_flavour,
  287.  
  288.   /* byteorder_big_p: data is big endian */
  289.   false,        /* Nope -- this one's little endian */
  290.  
  291.   /* header_byteorder_big_p: header is also big endian */
  292.   false,        /* Nope -- this one's little endian */
  293.  
  294.   /* object_flags: mask of all file flags */
  295.   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
  296.    DYNAMIC | WP_TEXT | D_PAGED),
  297.   
  298.   /* section_flags: mask of all section flags */
  299.   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
  300.    SEC_CODE | SEC_DATA | SEC_DEBUGGING),
  301.  
  302.    /* leading_symbol_char: is the first char of a user symbol
  303.       predictable, and if so what is it */
  304.    0,
  305.  
  306.   /* ar_pad_char: pad character for filenames within an archive header
  307.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  308.      of the archiver and/or os and should be independently tunable */
  309.   '/',
  310.  
  311.   /* ar_max_namelen: maximum number of characters in an archive header
  312.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  313.      of the archiver and should be independently tunable.  This value is
  314.      a WAG (wild a** guess) */
  315.   14,
  316.  
  317.   /* align_power_min: minimum alignment restriction for any section
  318.      FIXME:  this value may be target machine dependent */
  319.   3,
  320.  
  321.   /* Routines to byte-swap various sized integers from the data sections */
  322.   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  323.     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  324.     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
  325.  
  326.   /* Routines to byte-swap various sized integers from the file headers */
  327.   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  328.     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  329.     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
  330.  
  331.   /* bfd_check_format: check the format of a file being read */
  332.   { _bfd_dummy_target,        /* unknown format */
  333.     bfd_elf64_object_p,        /* assembler/linker output (object file) */
  334.     bfd_generic_archive_p,    /* an archive */
  335.     bfd_elf64_core_file_p    /* a core file */
  336.   },
  337.  
  338.   /* bfd_set_format: set the format of a file being written */
  339.   { bfd_false,
  340.     bfd_elf_mkobject,
  341.     _bfd_generic_mkarchive,
  342.     bfd_false
  343.   },
  344.  
  345.   /* bfd_write_contents: write cached information into a file being written */
  346.   { bfd_false,
  347.     bfd_elf64_write_object_contents,
  348.     _bfd_write_archive_contents,
  349.     bfd_false
  350.   },
  351.  
  352.       BFD_JUMP_TABLE_GENERIC (bfd_elf64),
  353.       BFD_JUMP_TABLE_COPY (bfd_elf64),
  354.       BFD_JUMP_TABLE_CORE (bfd_elf64),
  355.       BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  356.       BFD_JUMP_TABLE_SYMBOLS (bfd_elf64),
  357.       BFD_JUMP_TABLE_RELOCS (bfd_elf64),
  358.       BFD_JUMP_TABLE_WRITE (bfd_elf64),
  359.       BFD_JUMP_TABLE_LINK (bfd_elf64),
  360.       BFD_JUMP_TABLE_DYNAMIC (bfd_elf64),
  361.  
  362.   /* backend_data: */
  363.   (PTR) &elf64_bed,
  364. };
  365. #endif
  366.